home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1985 May / 1985-05.d64 / jog log_64 (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  146 lines

  1. 1 print"[147]":poke53280,6:poke53281,1
  2. 10 cl$=chr$(147):r$=chr$(18):rf$=chr$(146):d1$=chr$(17):u1$=chr$(145):q$=","
  3. 20 cr$=chr$(13):u3$=u1$+u1$+u1$:d2$=d1$+d1$:om$="(eq,ne,gt,lt,ge,le)"
  4. 40 m$="camdsx":printcl$tab(13)d2$r$"jogger's log"rf$d1$
  5. 50 input"   max # of runs?[157]";rm
  6. 60 dimdm%(12),c$(5,2),tb%(2,rm),n%(5),op$(5),vl$(5),d$(5)
  7. 70 fori=1to12:readdm%(i):next
  8. 80 forj=1to2:fori=1to5:readc$(i,j):nexti:nextj
  9. 90 gosub140:onmgoto700,760,800,860,920,220:goto90
  10. 100 print"  can't do past";r:fori=1to2000:next:goto90
  11. 110 input#15,a,b$,c,d:ifa=0thenreturn
  12. 120 printd2$"[147] error on disk":print a;b$;c;d:goto221
  13. 130 rem main menu
  14. 140 b$="":print"[147] c[146] create a file":print" a[146] add a file"
  15. 150 print" m[146] modify a record":print" d[146] delete a record"
  16. 160 print" s[146] show a record":print" x[146] exit"
  17. 170 input" ";b$:form=1to6:ifb$<>mid$(m$,m,1)thennext
  18. 180 return
  19. 190 rem misc subroutines
  20. 200 b$="y":printd1$tab(5):input"another(y/n)";b$:printcl$:return
  21. 210 input"  name";f$:input"  run # ";p:close15:open15,8,15:gosub290:return
  22. 220 close1:close2:close15:poke198,0:sys198
  23. 221 close1:close2:close15:end
  24. 230 input"  name";f$:close15:close2:open15,8,15:open2,8,2,"#":gosub290:return
  25. 240 forz=1to5:print"#";z;r$c$(z,1)rf$"="d$(z)d1$:nextz:return
  26. 250 printd1$"  "r$"cr"rf$" to continue":input"  ";b$:printcl$:return
  27. 260 printd2$tab(10)r$c$(z,1)rf$,c$(z,2):print tab(10):inputd$(z):return
  28. 270 rem disk subroutines
  29. 280 rem get index file
  30. 290 open1,8,0,"0:"+f$+".indx,s,r":gosub110
  31. 300 forn=1to600:input#1,tb%(1,n),tb%(2,n):ifst>64thenr=n-1:close1:return
  32. 310 ifn>rmthenprint"increase max run#":goto221
  33. 320 nextn
  34. 330 rem save index file
  35. 340 open1,8,1,"@0:"+f$+".indx,s,w":gosub110
  36. 350 forn=1tor:print#1,tb%(1,n)cr$tb%(2,n):gosub110:nextn:close1:close15:return
  37. 360 rem find next free track & block
  38. 370 t=1:b=1
  39. 380 print#15,"b-a:"0;t;b:input#15,a,b$,c,d:ifa=65thent=c:b=d:goto380
  40. 390 tb%(1,p)=t:tb%(2,p)=b
  41. 400 rem write run# p
  42. 410 print#2,d$(1)q$d$(2)q$d$(3)q$d$(4)q$d$(5)
  43. 420 print#15,"b-w:"2;0;tb%(1,p);tb%(2,p):return
  44. 430 rem read run# p
  45. 440 t=tb%(1,p):b=tb%(2,p):print#15,"b-r:"2;0;t;b
  46. 450 input#2,d$(1),d$(2),d$(3),d$(4),d$(5):return
  47. 460 rem end disk subroutines
  48. 470 rem selection
  49. 480 printcl$d1$tab(10)r$"selection criteria"rf$
  50. 490 printd2$tab(10)"enter #,option,value"d2$
  51. 500 forx=1to5:forz=1to5:printtab(12)"#";z;"is for ";c$(z,1):nextz
  52. 510 printtab(7)d2$"options ";om$:n%(x)=0
  53. 511 input"       ";n%(x),op$(x),vl$(x):printcl$
  54. 520 ifn%(x)=0thenx=x-1:return
  55. 530 nextx:return
  56. 540 rem calc pace
  57. 550 mi=val(mid$(tm$,1,2))*60+val(mid$(tm$,3,2))
  58. 560 mi=mi+val(mid$(tm$,5,2))/60:printtab(5)ds$"mi";:pa=mi/val(ds$)
  59. 570 pm=int(pa):ps=int((pa-pm)*60):tm$=str$(pm):a=len(tm$):b$=str$(ps)
  60. 580 d=len(b$):ds$="":ifd=2thends$="0"
  61. 590 print"..."mid$(tm$,2,a-1)":"ds$mid$(b$,2,d-1)" pace":return
  62. 600 rem calc day#
  63. 610 u=val(left$(dy$,2)):ifu<1oru>12thenprintt"bad month";dy$:goto221
  64. 620 da=dm%(u)+val(right$(dy$,2))*365+val(mid$(dy$,3,2)):return
  65. 630 rem keep him honest
  66. 640 rem dataentry
  67. 650 printcl$tab(10)"enter data on run # ";p
  68. 660 forz=1to5:d$(z)=""
  69. 670 gosub260:if(len(d$(z))<>6)and((z=1)or(z=3))thenprint"bad data":goto670
  70. 680 nextz:gosub370:return
  71. 690 rem create a file
  72. 700 input"  name";f$:open15,8,2,f$+".indx,s,r":open11,8,15:input#11,a$,b$,c$
  73. 710 ifb$<>"file not found"then1400
  74. 720 close11:close15:open15,8,15:open2,8,2,"#"
  75. 730 forp=1torm:gosub650:gosub200:ifb$="y"thennextp
  76. 740 r=p:gosub340:close2:goto90
  77. 750 rem add an entry
  78. 760 gosub230:ifr+1>rmthen100
  79. 770 r=r+1:p=r:gosub650
  80. 780 gosub340:close2:printcl$:goto90
  81. 790 rem modify run# p
  82. 800 gosub210:close2:open2,8,2,"#":ifp>rthen100
  83. 810 gosub440:print"[147]":gosub240
  84. 820 z=0:printd1$tab(5):input"(0=end) modify #";z
  85. 821 ifz>=6thenprint"[145]               bad #             ":goto820
  86. 830 ifz=0thenprintcl$:gosub410:close2:close15:goto90
  87. 840 gosub260:goto820
  88. 850 rem delete an entry
  89. 860 gosub210:ifp>rthen100
  90. 870 print#15,"b-f:"0;tb%(1,p);tb%(2,p)
  91. 880 if p<rthen forz=p+1tor:tb%(1,z-1)=tb%(1,z):tb%(2,z-1)=tb%(2,z):nextz
  92. 890 r=r-1:printcl$:gosub340:close2:goto90
  93. 900 rem analysis routines
  94. 910 rem show results
  95. 920 gosub230:gosub480
  96. 930 wm=0:wt=0:bg=0:printd2$tab(4)"enter 1[146] list  2[146] pace  3[146] plot"
  97. 940 input"    ";tx:printcl$:iftx<>3then960
  98. 950 printcl$d1$tab(3)"set scale...one * = how many miles"
  99. 951 input"   ";sc:sc=1/sc
  100. 960 forp=1tor:gosub440:ifx=0then1070
  101. 970 rem logical selection
  102. 980 fl=1:forw=1tox:n=n%(w)
  103. 985 if(n=1)or(n=2)or(n=3)then1041
  104. 990 ifop$(w)="eq"thenifd$(n)<>vl$(w)thenfl=0:goto1050
  105. 1000 ifop$(w)="ne"thenifd$(n)=vl$(w)thenfl=0:goto1050
  106. 1010 ifop$(w)="lt"thenifd$(n)>=vl$(w)thenfl=0:goto1050
  107. 1020 ifop$(w)="gt"thenifd$(n)<=vl$(w)thenfl=0:goto1050
  108. 1030 ifop$(w)="le"thenifd$(n)>vl$(w)thenfl=0:goto1050
  109. 1040 ifop$(w)="ge"thenifd$(n)<vl$(w)thenfl=0:goto1050
  110. 1041 d=val(d$(n)):v=val(vl$(w))
  111. 1042 ifop$(w)="eq"thenifd<>vthenfl=0:goto1050
  112. 1043 ifop$(w)="ne"thenifd=vthenfl=0:goto1050
  113. 1044 ifop$(w)="lt"thenifd>=vthenfl=0:goto1050
  114. 1045 ifop$(w)="gt"thenifd<=vthenfl=0:goto1050
  115. 1046 ifop$(w)="le"thenifd>vthenfl=0:goto1050
  116. 1047 ifop$(w)="ge"thenifd<vthenfl=0:goto1050
  117. 1050 nextw
  118. 1060 iffl=0then1260
  119. 1070 ontxgoto1090,1120,1180
  120. 1080 rem list
  121. 1090 print"          "r$"run # "rf$;p;d1$:gosub240:printd2$d1$:gosub250
  122. 1100 goto1260
  123. 1110 rem pace
  124. 1120 dy$=d$(1):gosub610:ifbg=0thenbg=da
  125. 1130 tm$=d$(3):ds$=d$(2):gosub550:wm=wm+mi/pa:wt=wt+mi:ifda<bg+6then1150
  126. 1140 bg=bg+7:ds$=str$(wm):mi=wt:printr$ds$"mi/wk"rf$;:gosub570:wt=0:wm=0
  127. 1150 ifwt=0thengosub250
  128. 1160 goto1260
  129. 1170 rem graph
  130. 1180 dy$=d$(1):gosub610:ifbg=0thenbg=da:e=0
  131. 1190 n0=da-bg:bg=da:ifn0<2then1210
  132. 1200 forz=2ton0:print"0":e=e+1:next
  133. 1210 ns=int(val(d$(2))*sc+.5):b$="*":ifns=1then1240
  134. 1220 ifns>23thenns=23
  135. 1230 forz=2tons:b$=b$+"*":nextz
  136. 1240 printb$:e=e+1:ife>15thene=0:gosub250
  137. 1250 ife=0thenforz=1to16:print" ";:next:print"[145][145]"
  138. 1260 nextp
  139. 1270 close1:close2:close15
  140. 1280 iftx<>1thengosub250
  141. 1290 goto90
  142. 1300 data0,31,59,90,120,151,181,212,243,273,304,334
  143. 1310 datadate,distance,time,route,comments,(mmddyy),(miles),(hhmmss)
  144. 1320 data(< 80 chrs),(< 80 chrs)
  145. 1400 print"  "f$" already exists[145][145][145][145][145]                ":close11:close15:goto700
  146.